/*    file: G711EncoderContext.h
 *    desc:
 *   
 * created: 2018-03-14
 *  author: chuanjiang.zh@qq.com
 * company: 
 */ 


#if !defined G711ENCODERCONTEXT_H_
#define G711ENCODERCONTEXT_H_

#include "CG711Encoder.h"
#include "MFormat.h"
#include "TByteBuffer.h"

class G711EncoderContext
{
public:

	G711EncoderContext();
	~G711EncoderContext();

	int open(int codec, int freq, int channels);
	void close();

	int encode(uint8_t* data, int length, int64_t pts, MPacket* pkt);

protected:
	av::G711Encoder	m_encoder;
	av::MediaProfile m_profile;
	int	m_freq;
	int m_channels;
	comn::ByteBuffer	m_buffer;

};

#endif //G711ENCODERCONTEXT_H_

